package cn.xianshu.org.service.impl;

import cn.xianshu.basic.query.BasicQuery;
import cn.xianshu.basic.service.IBasicService;
import cn.xianshu.basic.service.impl.BasicServiceImpl;
import cn.xianshu.basic.util.PageList;
import cn.xianshu.org.domain.Employee;
import cn.xianshu.org.mapper.EmployeeMapper;
import cn.xianshu.org.query.EmployeeQuery;
import cn.xianshu.org.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Service
//@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class EmployeeServiceImpl extends BasicServiceImpl<Employee> implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

   /* @Override
    public Employee findOne(Long id) {
        return employeeMapper.loadOne(id);
    }

    @Override
    public List<Employee> findAll() {
        return employeeMapper.loadAll();
    }

    @Override
    @Transactional
    public void delete(Long id) {
        employeeMapper.remove(id);
    }

    @Override
    @Transactional
    public void add(Employee employee) {
        employeeMapper.insert(employee);
    }

    @Override
    @Transactional
    public void update(Employee employee) {
        employeeMapper.update(employee);
    }



    @Override
    public void Bydelete(List<Long> ids) {
        employeeMapper.Bydelete(ids);
    }*/
   @Override
   public PageList<Employee> pageQuery(EmployeeQuery query) {
       // 总条数
       Integer total = employeeMapper.count(query);
       // 每页显示数据
       List<Employee> rows = employeeMapper.queryData(query);
       return new PageList<>(total, rows);
   }
    @Override
    public List<Employee> queryTree() {
        return employeeMapper.queryTree();
    }

    /*@Override
    public void insert(Employee employee) {
        employeeMapper.insert(employee);
    }*/

    @Override
    public PageList<Employee> queryList(BasicQuery query) {
        return null;
    }
}
